package design.simdi.code.final_paper.core.entities;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Version;

/**
 * 
 * @author Marius Dumitriu - (May 21, 2010 - 1:26:40 PM)
 * 
 */
@MappedSuperclass
public abstract class ApplicationEntity implements Serializable {

	private static final long serialVersionUID = 1L;

	private Long id;

	private Integer version;

	/**
	 * @return the id
	 */
	@Id
	@GeneratedValue(strategy= GenerationType.AUTO)
	@Column(unique = true, name = "Id", nullable = false)
	public Long getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the version
	 */
	@Version
	@Column(name = "OptLock")
	public Integer getVersion() {
		return version;
	}

	/**
	 * @param version
	 *            the version to set
	 */
	public void setVersion(Integer version) {
		this.version = version;
	}

}
